using System.Linq;
using Comteck.Entities.Users;
using Comteck.Security;

namespace Comteck.Ktt.Services.SeedData {
  /// <summary>
  /// 用户
  /// </summary>
  public class _20250429001_User : IDataSeed {
    /// <summary>
    /// 
    /// </summary>
    /// <param name="context"></param>
    public void Init(AppDbContext context) {
      // 用户
      if (!context.Users.Any()) {
        context.Users.Add(new User {
          Id = "admin",
          Name = "管理员",
          Phone = "12345678901",
          Password = SecurityFactory.GetSecurity("MD5").Encrypt("admin", null)
        });
        context.SaveChanges();
      }
    }
  }
}
